package cn.wind.xboot.logic.cli.dao;

import cn.wind.xboot.logic.cli.dto.CliDto;
import cn.wind.xboot.logic.cli.entity.CliClient;
import cn.wind.xboot.logic.dto.CliStoreDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 平台会员表 Mapper 接口
 * </p>
 *
 * @author xukk
 * @since 2018-06-19
 */
public interface CliClientMapper extends BaseMapper<CliClient> {
    /**
     * fetch data 根据手机号获取用户记录
     *
     * @param username 用户手机号
     * @return CliClient
     */
    @Select("select * from t_cli_client where username=#{username}"+
            " union "+
            "select * from t_cli_client cli where "+
            "EXISTS (select cli_id from t_cli_info cli_info where cli_info.mobile=#{username} and cli_id=cli.id )")
    CliClient findByUsername(@Param("username") String username);

    IPage<CliClient> findByCondition(IPage page, @Param("ew") Map<String, Object> var1);

    CliStoreDto findById(@Param( "id" ) Long id);



    List<CliDto> findCliAll();

    CliClient findCliById(@Param("cliId") Long cliId);
}
